/*
 * 使用 synchronized + wait + notify 可以实现线程的交替 run/sleep
 * 但是不能2个线程同时运行
 */

package org.wzq.learn;

import java.util.ArrayList;
import java.util.List;

public class UseCountDownLatch {
    volatile List<String> container = new ArrayList<String>();
    private final int capacity = 5;
    private int count = 0;
    // CountDownLatch remainsCount = new CountDownLatch(0);

    public void produce() {
        while (true) {

        }
    }

    public void consume() {
        while (true) {

        }
    }

    public static void main(String[] args) {
        UseCountDownLatch p = new UseCountDownLatch();
        new Thread(p::consume).start();
        new Thread(p::produce).start();
    }

}
